<template>
	<view class="imgSlide">
		<view class='swiper bottom-cell-group' v-if="imgSlideData.length > 0">
			<swiper class="swiper-c" :circular="swiper.circular" :indicator-dots="swiper.indicatorDots" :autoplay="autoplay"
			 :duration="swiper.duration">
				<swiper-item class="have-none" v-for="(item, index) in imgSlideData" :key="index">
					<image :src="item.swiperurl" mode="aspectFill" @tap.stop="previewImage" :data-index="index" :data-urllist="imgList"></image>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	import {
		previewImageMix
	} from '../util/mixins.js'
	export default {
		name: "imgSlide",
		mixins: [previewImageMix],
		props: {
			imgSlideData: {
				required: true,
			},
			autoplay: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				swiper: {
					indicatorDots: true,
					duration: 500,
					circular: true
				},
			};
		},
		computed: {
			imgList() {
				return this.imgSlideData.map(item => item.swiperurl)
			}
		}
	}
</script>

<style lang="scss">
	.swiper {
		height: 300upx;
		overflow: hidden;
	}
	
	.swiper-c {
		height: 100%;
	}
	
	.swiper-c image,
	.swiper-c swiper-item {
		width: 100%;
		height: 100%;
	}
</style>
